<template>
  <q-page class="cc-admin">

    <div class="col bg-white shadow-2 q-pa-md q-ma-sm">
      <q-table flat color="primary" class="cross_table" separator="cell" :columns="columns" :data="list" row-key="id" :pagination.sync="pagination" :visible-columns="group" @request="query" :rows-per-page-options="[10, 20, 50, 100]" selection="multiple" :selected.sync="selected">

        <!-- <template v-slot:top="table">
          <div class="row no-wrap full-width">
            <q-input clearable outlined dense placeholder="请输入关键字搜索" class="on-left" @input="query" debounce="500" v-model="key">
              <template #append>
                <q-btn flat round icon="search" color="primary" @click="query" :loading="loading">
                  <q-tooltip>搜索</q-tooltip>
                </q-btn>
              </template>
            </q-input>
            <q-space />
            <table-top-btns label="极端天气预警记录" modelName="weatherWarning" :showAdd="true" :table="table" :selected="selected" :importing="importing" :exporting="exporting" :importExcelUrlFull="importExcelUrlFull" :columns="columns" @groupChange="groupChange" @add="add" @importExcel="importExcel"
              @exportExcel="exportExcel" @showConfirm="showConfirm" />
          </div>
        </template> -->
        <template #body-cell-opt="props">
          <q-td :props="props" :auto-width="true">
            <q-btn flat round dense color="primary" icon="edit" @click="edit(props.row)"> <q-tooltip>编辑</q-tooltip></q-btn>
            <q-btn flat round dense color="primary" icon="mdi-content-copy" @click="copy(props.row)">
              <q-tooltip>复制</q-tooltip>
            </q-btn>
            <btn-del label="极端天气预警记录" @confirm="del(props.row)" />
          </q-td>
        </template>
      </q-table>
    </div>
    <q-dialog maximized flat persistent ref="dialog">
      <q-form @submit="submit" class="dialog_card column">
        <h5 class="view_title justify-between q-px-md">
          {{ editType }}极端天气预警记录
          <q-btn dense outline round icon="clear" size="sm" v-close-popup />
        </h5>
        <q-scroll-area class="col">
          <div class="row q-col-gutter-x-md dialog_form q-pa-md">
            <!-- <div class="col-12">
              <h5> 编号：</h5>
              <q-input outlined dense v-model="form.id" type="text" />
            </div> -->
            <!-- <div class="col-12">
              <h5> 平台id：</h5>
              <q-input outlined dense v-model="form.platformId" type="text" />
            </div> -->
            <div class="col-12">
              <h5> 预警状态：</h5>
              <q-input outlined dense v-model="form.alertStatus" type="text" />
            </div>
            <div class="col-12">
              <h5> 区域：</h5>
              <q-input outlined dense v-model="form.area" type="text" />
            </div>
            <div class="col-12">
              <h5> 城市：</h5>
              <q-input outlined dense v-model="form.cty" type="text" />
            </div>
            <div class="col-12">
              <h5> 内容：</h5>
              <q-input outlined dense v-model="form.content" type="text" />
            </div>
            <div class="col-12">
              <h5> 预警位置：</h5>
              <q-input outlined dense v-model="form.location" type="text" />
            </div>
            <div class="col-12">
              <h5> 省份：</h5>
              <q-input outlined dense v-model="form.province" type="text" />
            </div>
            <div class="col-12">
              <h5> 发布时间：</h5>
              <q-input outlined dense v-model="form.releaseDate" type="text" />
            </div>
            <div class="col-12">
              <h5> 发布来源：</h5>
              <q-input outlined dense v-model="form.releaseSource" type="text" />
            </div>
            <div class="col-12">
              <h5> 标题：</h5>
              <q-input outlined dense v-model="form.title" type="text" />
            </div>
            <div class="col-12">
              <h5> 预警级别：</h5>
              <q-input outlined dense v-model="form.warningLevel" type="text" />
            </div>
            <div class="col-12">
              <h5> 预警类型：</h5>
              <q-input outlined dense v-model="form.type" type="text" />
            </div>
          </div>
        </q-scroll-area>
        <div class="row justify-center q-pa-md">
          <q-btn outline color="primary" icon="mdi-close-thick" label="关闭" v-close-popup />
          <q-btn class="q-mx-md" color="primary" icon="mdi-check-bold" label="提交" :loading="loading" type="submit" />
        </div>
      </q-form>
    </q-dialog>
    <confirm ref="confirmDialog" :msg="confirmMsg" @confirm="deleteBatch()" />
    <q-inner-loading :showing="loading">
      <q-spinner-gears size="50px" color="primary" />
    </q-inner-loading>
  </q-page>
</template>

<script>
import { IndexMixin } from 'boot/mixins';
import { getDictLabel } from 'boot/dictionary';
import confirm from 'components/confirm';

export default {
  name: 'WeaWeatherWarning',
  mixins: [IndexMixin],
  components: {
    confirm,
  },
  data() {
    return {
      columns: [
        {
          name: 'index',
          align: 'center',
          label: '序号',
          field: 'index',
        },
        // {
        //   name: 'id', align: 'left', label: '编号', field: 'id',
        // },
        // {
        //   name: 'platformId', align: 'left', label: '平台id', field: 'platformId',
        // },
        {
          name: 'alertStatus', align: 'left', label: '预警状态', field: 'alertStatus',
        },
        {
          name: 'area', align: 'left', label: '区域', field: 'area',
        },
        {
          name: 'cty', align: 'left', label: '城市', field: 'cty',
        },
        {
          name: 'content', align: 'left', label: '内容', field: 'content',
        },
        {
          name: 'location', align: 'left', label: '预警位置', field: 'location',
        },
        {
          name: 'province', align: 'left', label: '省份', field: 'province',
        },
        {
          name: 'releaseDate', align: 'left', label: '发布时间', field: 'releaseDate',
        },
        {
          name: 'releaseSource', align: 'left', label: '发布来源', field: 'releaseSource',
        },
        {
          name: 'title', align: 'left', label: '标题', field: 'title',
        },
        {
          name: 'warningLevel', align: 'left', label: '预警级别', field: 'warningLevel',
        },
        {
          name: 'type', align: 'left', label: '预警类型', field: 'type',
        },
        // {
        //   name: 'opt', align: 'center', label: '操作', field: 'id',
        // },
      ],
      showQuery: true,
      headers: [{ name: 'Authorization', value: localStorage.Authorization }],
      uploadUrl: `${process.env.SERVER_URL}${process.env.BASE_URL}/sys/common/upload`,
      imgUrl: `${process.env.SERVER_URL}${process.env.BASE_URL}/sys/common/static`,
      url: {
        list: '/wea/weatherWarning/list',
        add: '/wea/weatherWarning/add',
        edit: '/wea/weatherWarning/edit',
        copy:
          '/wea/weatherWarning/copy',
        delete: '/wea/weatherWarning/delete',
        deleteBatch: '/wea/weatherWarning/deleteBatch',
        exportXlsUrl: '/wea/weatherWarning/exportXls',
        importExcelUrl: '/wea/weatherWarning/importExcel',
      },
    };
  },
  methods: {
    getDictLabel,
    initDict() {
    },
  },
  mounted() {
    this.initDict();
  },
};
</script>

<style lang="stylus">

</style>
